package com.csg.job;

import com.csg.service.IEnvironmentInfoService;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.quartz.QuartzJobBean;

/**
 * <p>
 *
 * </p>
 *
 * @author GeorgeChan 2019/11/25 18:48
 * @version 1.0
 * @since jdk1.8
 */
public class SyncEnvironmentInfoJob extends QuartzJobBean {
    private static final Logger LOGGER = LoggerFactory.getLogger(SyncEnvironmentInfoJob.class);
    private final IEnvironmentInfoService environmentInfoService;

    @Autowired
    public SyncEnvironmentInfoJob(IEnvironmentInfoService environmentInfoService) {
        this.environmentInfoService = environmentInfoService;
    }

    @Override
    protected void executeInternal(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        LOGGER.info("开始同步 rt_alarm 告警数据");
        environmentInfoService.syncData();
        LOGGER.info("结束同步 rt_alarm 告警数据");
    }
}
